package com.mzx.diy;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;

@Aspect//直接用注释定义，这就是一个切面
public class AnnotationPointCut {
    @Before("execution( * com.mzx.service.UserServiceImpl.*(..))")
    public void before(){
        System.out.println("==========方法执行之前============");
    }
    @After("execution( * com.mzx.service.UserServiceImpl.*(..))")
    public void after(){
        System.out.println("==========方法执行之后============");
}
    @Around("execution( * com.mzx.service.UserServiceImpl.*(..))")
    public void around(ProceedingJoinPoint jp)throws Throwable{
        System.out.println("==========环绕前============");
        Object proceed = jp.proceed();//执行方法
        System.out.println("==========环绕后============");

    }
}
